﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式.数据访问对象模式
{
    public class DaoPatternDemo
    {
        public static void Test()
        {
            IStudentDao studentDao = new StudentDaoImpl();

            foreach(Student student in studentDao.GetStudents())
            {
                Console.WriteLine("Student:[RollNo:" + student.RollNo + ",Name:" + student.Name + "]");
            }

            Student s1 = studentDao.GetStudents().First();
            s1.Name = "Michael";
            studentDao.UpdateStudent(s1);

            studentDao.GetStudent(0);
            Console.WriteLine("Student:[RollNo:" + s1.RollNo + ",Name:" + s1.Name + "]");

        }
    }
}
